// 主题配置常量
const THEME_CONFIG = {
  COMMON_VARS: [
    { name: '--primary-bg-color', value: '#F9F9F9' },
    { name: '--assist-bg-color', value: '#F5F5F5' },
    { name: '--accent-bg-color', value: '#FFFFFF' },
    { name: '--primary-text-color', value: '#000000' },
    { name: '--assist-text-color', value: '#333333' },
    { name: '--inverse-text-color', value: '#ffffff' },
    { name: '--border-color', value: '#EEEEEE' },
    { 
      name: '--statusBarHeight', 
      value: `${uni.getSystemInfoSync().statusBarHeight}px` 
    }
  ],
  TAB_BAR_ICONS: {
    homeicon: '/static/tabBar/home.png',
    usericon: '/static/tabBar/user.png'
  }
}

// 生成主题变量
function createThemeVars(primary, assist, accent, btn) {
  return [
    { name: '--primary-color', value: primary },
    { name: '--assist-color', value: assist },
    { name: '--accent-color', value: accent },
    { name: '--btn-bg-color', value: btn },
    { name: '--btn-text-color', value: '#ffffff' },
    ...THEME_CONFIG.COMMON_VARS,
  ]
}

// 主题列表
export const themeList = [
  {
    value: createThemeVars('#48b8d0', '#d1e4ff', '#d300f7', '#48b8d0'),
    name: '蓝色主题',
    bgImage: 'linear-gradient(90deg, #48b8d0, #4A879A)'
  },
  {
    value: createThemeVars('#19be6b', '#cce8d2', '#9933CC', '#19be6b'),
    name: '绿色主题',
    bgImage: 'linear-gradient(90deg, #57F960, #27B643)'
  },
  {
    value: createThemeVars('#06BFAD', '#cce8d2', '#9933CC', '#06BFAD'),
    name: '青色主题',
    bgImage: 'linear-gradient(90deg, #97E8B5, #06BFAD)'
  },
  {
    value: createThemeVars('#ef4136', '#ffdbe2', '#3F51B5', '#ef4136'),
    name: '红色主题',
    bgImage: 'linear-gradient(90deg, #FF896D, #D02020)'
  },
  {
    value: createThemeVars('#FF9800', '#fde4d1', '#795548', '#FF9800'),
    name: '橙色主题',
    bgImage: 'linear-gradient(90deg, #FFD439, #FF7A00)'
  },
  {
    value: createThemeVars('#8B4513', '#eadcd2', '#08b7a7', '#8B4513'),
    name: '棕色主题',
    bgImage: 'linear-gradient(90deg, #AD8211, #8B4513)'
  },
  {
    value: createThemeVars('#333333', '#dcdcdc', '#009688', '#333333'),
    name: '黑色主题',
    bgImage: 'linear-gradient(90deg, #666666, #181818)'
  },
  {
    value: createThemeVars('#993399', '#d6cbfb', '#623cec', '#993399'),
    name: '紫色主题',
    bgImage: 'linear-gradient(90deg, #D079EE, #8A88FB)'
  },
  {
    value: createThemeVars('#f6c133', '#ffebd2', '#795548', '#f6c133'),
    name: '黄色主题',
    bgImage: 'linear-gradient(90deg, #f1c000, #FFB800)'
  }
]

// 主题名称到图标后缀的映射
const THEME_ICON_MAP = {
  '蓝色主题': 'blue',
  '绿色主题': 'green',
  '青色主题': 'cyan',
  '红色主题': 'red',
  '橙色主题': 'orange',
  '棕色主题': 'brown',
  '黑色主题': 'black',
  '紫色主题': 'purple',
  '黄色主题': 'yellow'
}

// TabBar配置
export const tabBarList = themeList.map(theme => ({
  themeName: theme.name,
  ...THEME_CONFIG.TAB_BAR_ICONS,
  home: `/static/tabBar/home_${THEME_ICON_MAP[theme.name]}.png`,
  user: `/static/tabBar/user_${THEME_ICON_MAP[theme.name]}.png`
}))